﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Column.Dental.Core;

namespace Column.Dental.IdentityProvider
{
    public abstract class IdentityProvider : IIDentityProvider
    {
        public abstract Guid Id { get; }
        public abstract string Name { get; }

        protected abstract string GetToken();

        public Person GetPerson()
        {
            string token = GetToken();

            IdentityAssociation association =
                (from identityAssocation
                  in Data.Entities.IdentityAssociation
               where identityAssocation.Token == token
              select identityAssocation).FirstOrDefault();

            return association.Person;
        }

        public void Associate(Person person)
        {
            throw new NotImplementedException();
        }
    }
}
